/**
 * 
 */
package com.google.code.jkippt.parser;

import com.google.code.jkippt.resource.ClipList;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;

/**
 * @author "Federico De Faveri defaveri@gmail.com"
 *
 */
public class ClipListAdapterFactory implements TypeAdapterFactory {

	@Override
	@SuppressWarnings("unchecked")
	public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
		if (type.getRawType()!=ClipList.class) return null;

		TypeAdapter<ClipList> defaultAdapter = (TypeAdapter<ClipList>) gson.getDelegateAdapter(this, type);
		return (TypeAdapter<T>) new ClipListAdapter(defaultAdapter);
	}

}
